FixedPhysics now uses Double instead of Float for increased precision.#140
Merged
FixedPhysics now uses Double instead of Float for increased precision.#140
Conversation
…sed precision. Fix: AdvanceFixedUpdate now uses FixedPhysicsTimestep to tick FixedTime instead of incorrectly using FixedPhysicsFramerate.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR converts the fixed physics update system from single-precision (float) to double-precision (double) for improved accuracy in physics calculations. The changes affect timing calculations throughout the fixed update loop, including the physics accumulator, frame time calculations, and timestep management.
Changes:
- Added a new
DeltaDoubleproperty toGameTimefor accessing elapsed time with double precision - Changed
FixedPhysicsTimestepfromfloattodoublefor more precise timestep calculations - Updated
AdvanceFixedUpdatemethod to usedoublethroughout physics accumulation and timing logic - Modified
FixedTimeto useTick(double)instead ofTickF(float)for consistent double precision
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ShapeEngine/Core/Structs/GameTime.cs | Adds DeltaDouble property to provide direct access to the underlying ElapsedSeconds value without float conversion |
| ShapeEngine/Core/GameDef/GameGameloop.cs | Updates AdvanceFixedUpdate to accept and use double for all timing calculations and changes call from TickF to Tick |
| ShapeEngine/Core/GameDef/Game.cs | Changes FixedPhysicsTimestep property and physicsAccumulator field from float to double |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…meDelta and alpha calculations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.